home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 60.zip
/
BS1 part 60
/
Imagemaster d5.adf
/
piarc.lzh.parta
/
GetFile.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-03-22
|
3KB
|
112 lines
/*
* getfile.rexx
*
* Written by: Pete Patterson & Ben Williams
* Last Update: February 28, 1993
* For: Black Belt Systems image processing series IM, IM F/c, and IP.
* ---------------------------------------------------------------------------
* Revision: 1.0
*/
call pragma('stack',20000);
/*
* open rexxsupport.library -- needed for some functions
*/
if ~show('L',"rexxsupport.library") then do
if addlib('rexxsupport.library',0,-30,0) then do
/* everything's ok */
end;
else do
exit 10;
end;
end;
prtnme = 'IP_Port'; /* assume Image Professional */
if show('P','IP_Port') = 0 then do
if show('P','IM_Port') = 0 then do
say "Can't find image processor's ARexx port!!!"; /* not running? */
say "This script requires IP, IM or IM F/c to run!";
exit(20);
end;
else do
prtnme = 'IM_Port';
end;
end;
options;
address;
prevpath = 'ram:'; /* put user in ram to start with... */
if show('C', imloadpath) = 1 then do
prevpath = getclip(imloadpath);
end;
address(prtnme);
options results;
'filerequest "'||prevpath||'","","","Select File"';
lfile = result;
options;
if lfile = 'FR_CANCELLED' then do
exit 10;
end;
lfile = expandfilename(lfile);
thispath = gimmepath(lfile);
call setclip(imloadpath, thispath);
call open(fhandle,'ram:IP_FNAME.tmp','write'); /* open the file */
junk = writeln(fhandle, lfile);
call close(fhandle); /* close the file */
exit 0;
/*
* gimmepath
*
* This takes the provided argument and sucks the path out of it, then
* returns that path to the caller, sans file name.
*/
gimmepath:
arg fullnamegx;
tempgx = reverse(fullnamegx);
lengx = length(fullnamegx); /* get length of string */
slashdex = index(tempgx,'/'); /* first occurance of '/' from right */
colondex = index(tempgx,':'); /* first occurance of ':' from right */
seploc = 0; /* assumes current dir, no path supplied */
if slashdex ~= 0 then do /* we assume we are in a DIR */
seploc = (lengx - slashdex)+1;
end;
else do
if colondex ~= 0 then do /* we assume we are on a device */
seploc = (lengx - colondex)+1;
end;
end;
gxname = substr(fullnamegx,seploc+1); /* if you ever need it */
gxpath = left(fullnamegx,seploc);
return(gxpath);
/*
* Since this script can't be expected to know where the CD of the user
* is when this cmd is invoked, we have to check the path the user
* provides - if it's not specified right from a root, then we have
* to make it a complete specification from the root.
*/
expandfilename:
parse arg jfile;
if index(jfile,':') = 0 then do
curdir = pragma(D);
if right(curdir,1) ~= ':' then do
if right(curdir,1) ~= '/' then do
if curdir ~= '' then do
curdir = curdir || '/';
end;
end;
end;
jfile = curdir||jfile;
end;
return(jfile);